package week10;

import java.util.Scanner;
public class week1001 {
	

	    public static void main(String[] args) {
	        int[] arr = new int[5];
	        Scanner in = new Scanner(System.in);
	        while(in.hasNext()) {
	            String s = in.next();
	            if(s.equals("arr")) {
	                int t = in.nextInt();
	                try{
	                    int i = arr[t];
	                }
	                catch (Exception e) {
	                    System.out.println(e.toString());
	                }
	                continue;
	            }
	            if(s.equals("null")) {
	                NullPointerException e = new NullPointerException();
	                System.out.println(e.toString());
	                continue;
	            }
	            if(s.equals("cast")) {
	                ClassCastException e = new ClassCastException("java.lang.String cannot be cast to java.lang.Integer");
	                System.out.println(e.toString());
	                continue;
	            }
	            if(s.equals("num")){
	                String a = in.next();
	                try {
	                    Integer i = Integer.parseInt(a);
	                }
	                catch (Exception e) {
	                	
	                    System.out.println(e.toString());
	                }
	                continue;
	            }
	            break;
	        }
	    }
	}
